package aconcagua.measure

abstract class SimpleUnit extends UnitBehavior {

	// accessing
	@Override
	public denominator() {
		return new NullUnit();
	}
	
	@Override
	public numerator() {
		return this;
	}
	
	// arithmetic operations
	public divideByUnit(aUnit) {
		return aUnit.divide(this);
	}
	
	public multiplyByUnit(aUnit) {
		return aUnit.multiply(this);
	}

	// arithmetic operations - private
	@Override
	protected divide(DividedUnit aUnit) {
		return new DividedUnit(this, aUnit);
	}
	
	@Override
	protected divide(MultipliedUnit aUnit) {
		return new DividedUnit(this, aUnit);
	}
	
	@Override
	protected divide(NullUnit aUnit) {
		return new DividedUnit(aUnit, this);
	}
	
	@Override
	protected divide(SimpleUnit aUnit) {
		return new DividedUnit(this, aUnit);
	}
	
	@Override
	protected multiply(DividedUnit aUnit) {
		return new MultipliedUnit(aUnit, this);
	}
	
	@Override
	protected multiply(MultipliedUnit aUnit) {
		return new MultipliedUnit(aUnit, this);
	}
	
	@Override
	protected multiply(NullUnit aUnit) {
		return aUnit.multiply(this);
	}
	
	@Override
	protected multiply(SimpleUnit aUnit) {
		return new MultipliedUnit(this, aUnit);
	}
	
	// measure creation
	public with(aNumber) {
		return new Measure(aNumber, this);
	}
}
